package us.mooresr.webtroopmanager.shared;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Id;



import com.google.gwt.user.client.rpc.IsSerializable;


public class Role implements IsSerializable {
	

	@Id Long roleId;
	

	String roleName;
	

	Set<Privilege> privileges;
	
	@SuppressWarnings("unused")
	private Role() {
		
	}
	
	
	
	public Role(Long roleId, String roleName, Set<Privilege> privileges) {
		super();
		this.roleId = roleId;
		this.roleName = roleName;
		this.privileges = privileges;
	}



	public Role(String roleName) {
		this.roleName = roleName;
		this.privileges = new HashSet<Privilege>();
	}
	
	public Role(String roleName, Set<Privilege> privileges) {
		this.roleName = roleName;
		this.privileges = privileges;
	}
	
	public Set<Privilege> getPrivileges() {
		return privileges;
	}
	
	public void setPrivileges(Set<Privilege> privileges) {
		this.privileges = privileges;
	}
	
	public void addPrivilege(Privilege privilege) {
		privileges.add(privilege);
	}
	
	public Long getId() {
		return roleId;
	}
	
	public String toString() {
		return roleName;
	}



	public String getRoleName() {
		return roleName;
	}



	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	
	
	
	
}
